/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import persistencia.entidade.Categoria;

/**
 *
 * @author Novo usuário
 */
public class CategoriaListCellRenderer extends JLabel implements ListCellRenderer {

    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

        Categoria cat = (Categoria) value;
        this.setText(cat.getNome());
        if (isSelected) {
            setForeground(Color.BLUE);
        } else {
            setForeground(Color.black);
        }
        return this;

    }
}
